#include "ReadCode.h"

ReadCode::ReadCode()
{}

void haffman::readcode()
{
  FILE *tem;
  tem = fopen(code_name, "r");
  if (tem == 0)
  {
    return;
  }
  bas_len = 0;
  char s1[10];
  fscanf(tem, "%s",    &s1);
  formulate = s1;                     // 读取文件格式
  fscanf(tem, "%d %d", &max_bu, &bu); // 读取缓冲区大小
  while (!feof(tem))                  // 读取字符 编码 编码长度
  {
    bas[bas_len] = new tree;
    if (fscanf(tem, "%d %d %d", &bas[bas_len]->data, &bas[bas_len]->code, &bas[bas_len]->code_len) == 3) ++bas_len;
  }
  fclose(tem);
}
